package com.xianrenit.xianrenpuzi.product.controller;

import com.xianrenit.xianrenpuzi.model.entity.product.Category;
import com.xianrenit.xianrenpuzi.model.result.Result;
import com.xianrenit.xianrenpuzi.product.service.CategoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Tag(name = "分类模块")
@RequestMapping("/api/product/category")
public class CategoryController {
    @Resource
    CategoryService categoryService;
    @Operation(summary = "查询分类嵌套集合接口")
    @GetMapping("/findCategoryTree")
    public Result findCategoryTree(){
        //查询123级分类嵌套集合，返回1及分类集合，
        List<Category> parents = categoryService.findCategoryTree();
        return Result.ok(parents);
    }
}
